package com.binyouwei.designpatterns.behavior.observer;

/**
 * @author 宾有为
 * @date 2024/7/17 19:55
 * @link https://blog.csdn.net/baidu_41616022?type=blog
 * @describe：观察者模式 - 当一个对象的状态发生改变时，其所有依赖者都会收到通知并自动更新。
 **/
public class ObserverMain {
    public static void main(String[] args) {
        ObserverSubject subject = new ObserverSubject();

        new OctalObserver(subject);
        new BinaryObserver(subject);

        System.out.println("First state change: 15");
        subject.setState(15);
        System.out.println("Second state change: 10");
        subject.setState(10);
    }
}
